package threadLearn;

import java.util.Arrays;
import java.util.Scanner;

public class demon8 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int k = in.nextInt();
            int[] nums = {2, 4, 8, 10, 11};
            int sum = 0;
            Arrays.sort(nums);
            int count = 0;
            for (int i = nums.length - 1; i > 0; i--) {
                if (nums[i] % 2 == 0) {
                    nums[i] = nums[i] / 2;
                    count++;
                }
                if (k == count) {
                    break;
                }
                for (int m = 0; m < nums.length; m++) {
                    sum += nums[m];
                }

            }
            System.out.println(sum);
        }
    }
}
